/*
 * Copyright 2018-present KunMinX
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.nsgf.library.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;

import androidx.recyclerview.widget.RecyclerView;

import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter;
import com.nsgf.library.R;
import com.nsgf.library.data.bean.MessageBean;
import com.nsgf.library.databinding.ItemNsgfMessageBinding;
import com.nsgf.library.ui.page.MessageDetailsActivity;

/**
 * Create by GC at 24/11/19
 */
public class PlaylistAdapter extends SimpleDataBindingAdapter<MessageBean.DataBean, ItemNsgfMessageBinding> {

    public PlaylistAdapter(Context context) {
        super(context, R.layout.item_nsgf_message, DiffUtils.getInstance().getMessageItemCallback());

    }

    @Override
    protected void onBindItem(ItemNsgfMessageBinding binding, MessageBean.DataBean item, RecyclerView.ViewHolder holder) {
        binding.setAlbum(item);

        switch (item.getType()) {
            case "message.type.1":
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#A0D1F6"));
                break;
            case "message.type.2":
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame_red);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#F5B9BA"));
                break;
            case "warn.type.1":
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame_or);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#FF950B"));
                break;
            case "warn.type.2":
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame_bule);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#06B293"));
                break;
            case "warn.type.3":
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame_gr);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#5C7BED"));
                break;
            default:
                binding.tvItemMessageType.setBackgroundResource(R.drawable.bg_message_type_frame);
                binding.tvItemMessageType.setTextColor(Color.parseColor("#A0D1F6"));
                break;

        }
    }
}
